<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<!--移交数据弹窗 -->

<div class="content-warp">
    <div class="distribPersonel" id="transferOrderPageBox" style="padding: 20px 20px">
        <form action="" id="transferOrderBoxForm">
            <div class="table-warp">
                <c:if test="${isShow eq true}">
                    <table class="cell-border crm-table columnsHidden dataTable" id="orderTable">
                        <tr style="text-align: center">
                            <td><b>序号</b></td>
                            <td><b>生产单编号</b></td>
                            <td><b>合同编号</b></td>
                            <td><b>流程人员</b></td>
                            <td><b>操作</b></td>
                        </tr>
                        <c:forEach items="${orderList}" var="order" varStatus="status">
                            <tr style="text-align: center">
                                <td>${status.index + 1}</td>
                                <td>${order.scProductOrderNo}<input name="subOrderIds" type="hidden"
                                                                    value="${order.id}"></td>
                                <td>${order.contractNo}</td>
                                <td>${order.flowUserName}</td>
                                <td>
                                    <a href="JavaScript:void(0);" class="layui-btn layui-btn-orange"
                                       onclick="removeOrder(this)">剔除</a>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                </c:if>
                <c:if test="${isShow eq false}">
                    <c:forEach items="${orderList}" var="order" varStatus="status">
                        <p>生产单编号:${order.scProductOrderNo}<input name="subOrderIds" type="hidden" value="${order.id}"></p>
                        <p style="margin-top: 15px">合同编号:${order.contractNo}</p>
                        <p style="margin-top: 15px">流程人员:${order.flowUserName}</p>
                    </c:forEach>
                </c:if>
            </div>
            <div class="layui-inline" style="margin-top: 15px">
                <label>流程人员：</label>
                <div class="layui-input-inline">
                    <select id="userId" name="userId" class="flowUserIdChooseUser">
                        <option value="">--请选择--</option>
                    </select>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        console.log(111111)
        //初始化分配人员选择
        chooseUserPlug.init($('#userId'), {
            url: sysInfo.basePath + '/zzsc/common/find_user_choose.do',
            // multiple:true,// 单选false或不写该参数，多选true
            otherParam: {
                type: 'role',
                roleCode: 'ZZSC_FLOW_USER',
                locked: '0'
            }
        });
    });

    function removeOrder(obj) {
        var num = $("#orderTable").children().children("tr").length;
        console.log(num);
        if (num == 2) {
            DGG.Errors('请至少保留一个订单!');
            return;
        }
        $(obj).parent().parent().remove();
    }

</script>